﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserIndex.aspx.cs" Inherits="Yule8xWechat.Agent.UserIndex" %>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>玩家首页<%=user_id>0?user_id.ToString():string.Empty %></title>
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/comm.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/icon.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/my.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Css/agent.css" />
    <link rel="stylesheet" type="text/css" href="../Skin/Theme/Plugins/widget/iscroll/css/iscroll2.css" />
    <script src="../Skin/Theme/Js/flexible_css.js" type="text/javascript" charset="utf-8"></script>
    <script src="../Skin/Theme/Js/flexible.js" type="text/javascript" charset="utf-8"></script>
    <style>
        .layui-layer-title {
            text-align: center !important;
            font-size: 16px !important;
            color: #ff0000 !important;
        }
    </style>
</head>

<body>
    <script src="../Skin/Theme/Js/jquery_2.1.3.js" type="text/javascript" charset="utf-8"></script>
    <script src="../Skin/Plugins/DialogLib/layer-v3.0.1/layer.js" type="text/javascript"></script>
    <div class="content  b-h" id="content">
        <div id="scroller" class="scroller">
            <div id="pullDown" class="pulldown">
                <div class="pullDownLabel"></div>
            </div>
            <!--头部信息二维码-->
            <div class="topinfo">
                <div class="infoarea">
                    <span class="headimg">
                        <img src="<%=wxUser.headimgurl %>"></span>
                    <span class="nameinfo">
                        <div class="myname"><%=wxUser.nickname %></div>
                        <div class="mygameid">代理ID <%=wxUser.user_id %></div>
                    </span>
                    <a href="QrInfo.aspx">
                        <span class="detailarrow">
                            <img src="../Skin/Theme/Images/my/arrow.png"></span>
                        <span class="qrimg">
                            <img src="../Skin/Theme/Images/my/qrcode.png"></span>

                    </a>
                </div>
            </div>
            <div class="clear"></div>
            <!--代理数据信息-->

            
            <% if (!isDrawFreeDiamond)
                { %>
            <div class="splitmenulist">
                <ul>
                    <li class="stmenu" style="width:3.64rem"><a href="../Promotion/GetFreeDiamond.aspx?user_id=<%=user_id %>">
                        <div class="menucontent">
                            <span class="mimg">
                                <img src="../Skin/Theme/Images/my/mianfeilingka.png"></span><span class="mtitle">免费领取钻石</span>
                        </div>
                    </a></li>
                    <li class="stmenu"><a href="../Payment/WxPay/BuyCard.aspx?user_id=<%=user_id %>">
                        <div class="menucontent">
                            <span class="mimg">
                                <img src="../Skin/Theme/Images/my/goumaifangka.png"></span><span class="mtitle">购买钻石</span>
                        </div>
                    </a></li>
                </ul>
            </div>
            <div class="clear"></div>
            <%}
                else
                { %>
            <div class="menulist">
                <ul>
                    <li class="menudetail">
                        <div class="menucontent">
                            <a href="../Payment/WxPay/BuyCard.aspx?user_id=<%=user_id %>"><span class="mimg">
                                <img src="../Skin/Theme/Images/my/goumaifangka.png"></span><span class="mtitle">购买钻石</span><span class="marrow"><img src="../Skin/Theme/Images/my/arrow1.png"></span></a>
                        </div>
                    </li>
                </ul>
            </div>
            <%} %>
            <div class="regbutton">
                <a href="../Payment/WxPay/AgentRegistion.aspx?user_id=<%=user_id %>">
                    <img src="../Skin/Theme/Images/my/toagent.png"></a>
            </div>
            <!--向上滚动-->
            <!-- style="overflow: hidden; height: 253px; width: 410px; margin-top: 15px; margin-left: 15px; line-height: 24px;"-->
            <div id="colee">
                <div id="colee1" data-url="/PublicServices/NoticeService.aspx?count=30"></div>
                <div id="colee2"></div>
            </div>
            <!--/向上滚动-->
            <!--菜单区域-->
            <div id="pullUp" class="pullup">
                <div class="pullUpLabel">
                </div>
            </div>
        </div>
    </div>
    
    <script src="../Skin/Theme/Plugins/widget/iscroll/js/iscroll-probe.js" type="text/javascript" charset="utf-8"></script>
    <input type="hidden" id="showqrcode" value="<%=isShowQrCode %>" />
    <script type="text/javascript">
        if ($('#showqrcode').val() == '1') {
            openqrcode();
        }
        function openqrcode() {
            layer.open({
                title: '为确保您的利益，请先关注微信公众号',
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['325px', '360px'], //宽高
                content: '<div><img src="/Skin/Theme/Images/layerqrcode.jpg" alt="扫描关注公众号" style="width:320px;" /></div>'
            });
        }
    </script>
    <script>
        function getnotices() {
            var $dom = $('#colee1');
            $dom.load($dom.data('url'), function (data) {
                if (!data) {
                    return;
                }
                data = $.parseJSON(data);
                var str = '<ul>';
                for (var i in data) {
                    str += '<li>恭喜' + data[i] + '成为代理</li>';
                }
                str += '</ul>';
                $dom.html(str);
                if (!$dom.data('first')) {
                    $dom.data('first', true);
                    marqueeUp();
                }
            })
        }
        getnotices();
        setInterval(getnotices, 60000);
        function marqueeUp() {
            var speed = 80;
            var colee2 = document.getElementById("colee2");
            var colee1 = document.getElementById("colee1");
            var colee = document.getElementById("colee");
            colee2.innerHTML = colee1.innerHTML; //克隆colee1为colee2
            function Marquee1() {
                //当滚动至colee1与colee2交界时
                if (colee2.offsetTop - colee.scrollTop <= 0) {
                    colee.scrollTop -= colee1.offsetHeight; //colee跳到最顶端
                } else {
                    colee.scrollTop++
                }
            }
            var MyMar1 = setInterval(Marquee1, speed)//设置定时器
            //鼠标移上时清除定时器达到滚动停止的目的
            colee.onmouseover = function () { clearInterval(MyMar1) }
            //鼠标移开时重设定时器
            colee.onmouseout = function () { MyMar1 = setInterval(Marquee1, speed) }
        }
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            loaded();
        })
        $("#warning-block").show();
        var myScroll;
        var pullDownEl, pullDownL;
        var pullUpEl, pullUpL;
        var Downcount = 0, Upcount = 0;
        var loadingStep = 0;//加载状态0默认，1显示加载状态，2执行加载数据，只有当为0时才能再次加载，这是防止过快拉动刷新

        function pullDownAction() {//下拉事件
            setTimeout(function () {
                location.reload();
            }, 100); //1秒
        }
        function pullUpAction() {//上拉事件
            setTimeout(function () {
                var el, li, i;
                el = $('#add');
                for (i = 0; i < 3; i++) {
                    li = $("<li></li>");
                    Upcount++;
                    li.text('new Add ' + Upcount + " ！");
                    //程序将新增数据加载到这
                    el.append(li);
                }
                pullUpEl.removeClass('loading');
                pullUpEl['class'] = pullUpEl.attr('class');
                pullUpEl.attr('class', '').hide();
                myScroll.refresh();
                loadingStep = 0;
            }, 100);
        }

        function loaded() {
            pullDownEl = $('#pullDown');
            pullDownL = pullDownEl.find('.pullDownLabel');
            pullDownEl['class'] = pullDownEl.attr('class');
            pullDownEl.attr('class', '').hide();
            pullUpEl = $('#pullUp');
            pullUpL = pullUpEl.find('.pullUpLabel');
            pullUpEl['class'] = pullUpEl.attr('class');
            pullUpEl.attr('class', '').hide();
            myScroll = new IScroll('#content', {
                probeType: 2,//probeType：1对性能没有影响。在滚动事件被触发时，滚动轴是不是忙着做它的东西。probeType：2总执行滚动，除了势头，反弹过程中的事件。这类似于原生的onscroll事件。probeType：3发出的滚动事件与到的像素精度。注意，滚动被迫requestAnimationFrame（即：useTransition：假）。
                scrollbars: true,//有滚动条
                mouseWheel: true,//允许滑轮滚动
                fadeScrollbars: true,//滚动时显示滚动条，默认影藏，并且是淡出淡入效果
                bounce: true,//边界反弹
                interactiveScrollbars: true,//滚动条可以拖动
                shrinkScrollbars: 'scale',// 当滚动边界之外的滚动条是由少量的收缩。'clip' or 'scale'.
                click: true,// 允许点击事件
                keyBindings: true,//允许使用按键控制
                momentum: true// 允许有惯性滑动
            });
            //滚动时
            myScroll.on('scroll', function () {
                if (loadingStep == 0 && !pullDownEl.attr('class').match('flip|loading') && !pullUpEl.attr('class').match('flip|loading')) {
                    if (this.y >= 0) {
                        //下拉刷新效果
                        pullDownEl.attr('class', pullUpEl['class'])
                        pullDownEl.show();
                        myScroll.refresh();
                        pullDownEl.addClass('flip');
                        loadingStep = 1;
                    }
                }
            });
            //滚动完毕
            myScroll.on('scrollEnd', function () {
                if (loadingStep == 1) {
                    if (pullUpEl.attr('class').match('flip|loading')) {
                        pullUpEl.removeClass('flip').addClass('loading');
                        loadingStep = 2;
                    } else if (pullDownEl.attr('class').match('flip|loading')) {
                        pullDownEl.removeClass('flip').addClass('loading');
                        loadingStep = 2;
                        pullDownAction();
                    }
                }
            });
        }
        document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
    </script>
    
    
</body>
</html>
